# -*- coding:utf-8 -*-
from application import app, manager
from flask_script import Server
from jobs.launcher import runJob
import www

'''
程序入口 主程序 job任务等
'''

# web server(主服务入口)
manager.add_command("runserver",
                    Server(host='0.0.0.0', port=app.config['SERVER_PORT'], use_debugger=True, use_reloader=True))

# job entrance(job入口)
manager.add_command('runjob', runJob())


# 主程序
def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
